#!/bin/bash
#
# Patchwork - automated patch tracking system
# Copyright (C) 2010 Jeremy Kerr <jk@ozlabs.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later

TOOLS_DIR="$(dirname "$0")"
PW_DIR="${TOOLS_DIR}/../patchwork"

if [ "$#" -lt 1 ]; then
    echo "usage: $0 <revspec>" >&2
    exit 1
fi

git rev-list --reverse "$@" |
while read -r commit; do
    hash=$(git diff "$commit~..$commit" | python "$PW_DIR/hasher.py")
    pwclient update -s Accepted -c "$commit" -h "$hash"
done
